﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xant.FlowEngine.Core
{
    public class ProcessTemplate : AbstractProcess
    {

        #region 属性
        #endregion

        #region 构造函数
        public ProcessTemplate(string name) : base(name)
        {

        }

        #endregion

        #region 公有方法
        /// <summary>
        /// 验证流程定义是否合法，不合法则抛出异常FlowDefineException
        /// <remarks>
        /// 例如：是否有起始节点和最终节点，是否能从起始节点流向最终节点
        /// </remarks>
        /// </summary>
        public void Validate()
        {
            if (StartActivity == null)
            {
                throw new ProcessTemplateException(ProcessTemplateExceptionType.MissStartActivity);
            }
            if (EndActivity == null)
            {
                throw new ProcessTemplateException(ProcessTemplateExceptionType.MissEndActivity);
            }
        }

        #endregion

    }
}
